package eu.tanov.epf.pv.types.project.ui.pages;

import java.util.HashSet;
import java.util.Set;

import org.eclipse.epf.uma.CustomCategory;

public class SelectableProjectPractice {

	protected CustomCategory practice;
	protected boolean isSelected;
	protected Set<CustomCategory> projects;

	public Set<CustomCategory> getProjects() {
		return projects;
	}

	public SelectableProjectPractice(CustomCategory practice) {
		super();
		this.practice = practice;
		this.projects = new HashSet<CustomCategory>();
	}

	public String getName() {
		return practice.getName();
	}

	// TODO add getters for usage lvl, satisfaction, agile method/practice/lvl

	public boolean isSelected() {
		return isSelected;
	}

	public void setSelected(boolean isSelected) {
		this.isSelected = isSelected;
	}

	public CustomCategory getPractice() {
		return practice;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((practice == null) ? 0 : practice.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		SelectableProjectPractice other = (SelectableProjectPractice) obj;
		if (practice == null) {
			if (other.practice != null)
				return false;
		} else if (!practice.equals(other.practice))
			return false;
		return true;
	}

}
